<?#//v.3.1.1
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";
unset($ERR);

#//
if($_POST[action] == "update" && phpa_securepost($_POST))
{
	#// Data check
	if($_POST[status] == 'enabled' && (!is_numeric($_POST['timebefore']) || !is_numeric($_POST['extend'])))
	{
		$ERR = $MSG_2_0038;
		$SETTINGS = $_POST;
	}
	else
	{
	
	
	
	
	
	
	
	
	
		$query = "update PHPAUCTIONXL_auctionextension SET
				  status='".$_POST['status']."',
				  timebefore=".intval($_POST['timebefore']).",
				  extend=".intval($_POST['extend']);
		$res = @mysql_query($query);
		if(!$res)
		{
			print "Error: $query<BR>".mysql_error();
			exit;
		}
		else
		{
			$ERR = $MSG_2_0039;
			$SETTINGS = $_POST;
		}
	}
	
	
	                        $time_reset = $_POST[time_reset];           
    
$query2="UPDATE PHPAUCTIONXL_version_2_0 SET timer_reset='$time_reset' WHERE id='1'";
       
mysql_query($query2);
	
	     	
}

#//
$query = "SELECT * FROM PHPAUCTIONXL_auctionextension";
$res = @mysql_query($query);
if(!$res)
{
	print "Error: $query<BR>".mysql_error();
	exit;
}
elseif(mysql_num_rows($res) > 0)
{
	$SETTINGS = mysql_fetch_array($res);
}

 $query1 = "SELECT * FROM PHPAUCTIONXL_version_2_0";
$res1 = @mysql_query($query1);
if(!$res1)
{
	print "Error: $query1<BR>".mysql_error();
	exit;
}
elseif(mysql_num_rows($res1) > 0)
{
	$SETTINGS1 = mysql_fetch_array($res1);
}










?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<bodyleftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/auction_icon2.gif" width="31" height="25" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_239?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_2_0032?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">

<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD align="center">
	<BR>
	<FORM NAME=conf ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
		<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0"  class="base" style="border:1px solid #ccc;">
			<TR>
				<TD ALIGN=CENTER class=title>
				<p>	<? print $MSG_2_0032; ?></p>
				</TD>
			</TR>
			<TR>
				<TD>

	<TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0">
	  <?
		if($ERR != "")
		{
		 ?>
	  <TR>
		<TD COLSPAN="2" class="error">
		 <p> <? print $ERR; ?></p>		 </TD>
	  </TR>
	  <?
			}
		?>
	  <TR VALIGN="TOP">
		<TD HEIGHT="7" colspan="2">
		  <p><?=$_CUSTOM_0032;?></p>		  </TD>
		</TR>

	
	  <TR VALIGN="TOP">
		<TD WIDTH=125 HEIGHT="31" class="gris">
		 <p> <?=$MSG_2_0034;?>	</p>	  </TD>
		<TD HEIGHT="31" WIDTH="418" class="gris">
		  <input type="radio" name="status" value="enabled" <?if($SETTINGS['status'] == 'enabled') print " CHECKED";?>>
		  
		  <?=$MSG_030;?>
		  
		  <input type="radio" name="status" value="disabled" <?if($SETTINGS['status'] == 'disabled') print " CHECKED";?>>
		  
		  <?=$MSG_029;?>		   </TD>
	  </TR>
	 
	  <TR VALIGN="TOP">
		<TD WIDTH=125 HEIGHT="31">&nbsp;		  </TD>
		<TD HEIGHT="31" WIDTH="418">
		  <?=$MSG_2_0035;?>
		   &nbsp;
		  <input type=text name=extend value="<?=$SETTINGS['extend']?>" size=5>
		  &nbsp; &nbsp;
		   
		  <?=$MSG_2_0036;?>
		   &nbsp;
		  <input type=text name=timebefore value="<?=$SETTINGS['timebefore']?>" size=5>
		  &nbsp; &nbsp;
		   
		  <?=$MSG_2_0037;?>		   </TD>
	  </TR>
	 
	 
	 
	 
	 
	  <TR VALIGN="TOP">
		<TD WIDTH=125 HEIGHT="31" class="gris">
		 <p> <?=$MSG_AJAX_ADMIN_TIME_RESET;?>	</p>	  </TD>
		<TD HEIGHT="31" WIDTH="418" class="gris">
		  <input type="radio" name="time_reset" value="1" <?if($SETTINGS1['timer_reset'] == '1') print " CHECKED";?>>
		  
		  <?=$MSG_030;?>
		  
		  <input type="radio" name="time_reset" value="0" <?if($SETTINGS1['timer_reset'] == '0') print " CHECKED";?>>
		  
		  <?=$MSG_029;?>		   </TD>
	  </TR>
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	  <TR>
		<TD WIDTH=125>
		  <INPUT TYPE="hidden" NAME="action" VALUE="update" /> <INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />
		  <INPUT TYPE="hidden" NAME="id" VALUE="<?=$id?>">		</TD>
		<TD WIDTH="418">
		  <INPUT TYPE="submit" NAME="act" VALUE="<? print $MSG_530; ?>" class="action">		</TD>
	  </TR>
	  <TR>
		<TD WIDTH=214></TD>
		<TD WIDTH="418"> </TD>
	  </TR>
	</TABLE>
				</TD>
			</TR>
		</TABLE>
		</FORM>

</TD>
</TR>
</TABLE>

<!-- Closing external table (header.php) -->
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>